package validator

import "github.com/gin-gonic/gin"

func BindAndValidate(c *gin.Context, obj interface{}) error {
	if err := c.ShouldBind(obj); err != nil {
		return err
	}

	if err := Validate.Struct(obj); err != nil {
		return err
	}

	return nil
}
